package com.ecloud.service.security.feign.fallback;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import com.ecloud.common.base.result.Result;
import com.ecloud.common.base.result.Rows;
import com.ecloud.common.web.result.FallBackBuilder;
import com.ecloud.openapi.translate.dto.BaseDictionaryDto;
import com.ecloud.openapi.translate.vo.BaseDictionaryListVo;
import com.ecloud.service.security.feign.iface.BaseDictionaryFeign;

/**
 * 字典断路器工厂
 *
 * @author LiuGangQiang Create in 2021/08/14
 */
@Component
public class BaseDictionaryFallbackFactory implements FallbackFactory<BaseDictionaryFeign> {

    @Override
    public BaseDictionaryFeign create(Throwable cause) {
        return new BaseDictionaryFeign() {

            @Override
            public Result<Rows<BaseDictionaryListVo>> queryList(BaseDictionaryDto dto) {
                return FallBackBuilder.build(cause);
            }
        };
    }

}
